package com.webex.ta.hydra.gui.action;

import com.webex.ta.hydra.gui.GuiPackage;

import java.awt.event.ActionEvent;
import java.util.HashSet;
import java.util.Set;

/**
 * Created by Cisco WebEx.
 * User: vegaz
 * Date: 2010-9-17
 * Time: 12:47:23
 */
public class UndoRedoAction implements ActionHandler {
    private static Set<String> commands = new HashSet<String>();

    static {
        commands.add(ActionNames.UNDO);
        commands.add(ActionNames.REDO);
    }

    public Set<String> getActionNames() {
        return commands;
    }

    public void doAction(ActionEvent e) {
        GuiPackage gp = GuiPackage.getInstance();
        if (ActionNames.UNDO.equals(e.getActionCommand()))
            gp.getHydraTable().undo();
        else if (ActionNames.REDO.equals(e.getActionCommand()))
            gp.getHydraTable().redo();
        gp.updateMenuAndToolBar();
    }
}
